﻿/**
 * ...
 * @author George Mavchun
 */

package gui.hug.priv;

import flash.display.Shape;
import flash.display.Sprite;
import gui.hug.HUGLabel;

class HUGTabButtonDisplayState extends Sprite
{

	public var factWidth : Float;
	
	public function new(text : String, bgColor : Int) 
	{
		super();
		addImage(bgColor, text);
	}

	private function addImage(bgColor : Int, text : String) {
		var label : HUGLabel = new HUGLabel();
		label.setLocation(10, 2);
		label.htmlText = text;
		
		factWidth = 10 + label.width + 10;
		
		var shape = new Shape();
		shape.graphics.beginFill(bgColor);
		shape.graphics.drawRoundRectComplex(0, 0, factWidth, 24, 4, 4, 0, 0);
		shape.graphics.endFill();
		
		addChild(shape);
		addChild(label);
	}
	
	public function getFactWidth() : Float {
		return factWidth;
	}
}